﻿@model HWmanagementClient.Models.AdminModel
@{
    ViewBag.Title = "Admin";
}

<script type="text/javascript">

    function generate() {
        showLoader();
        $.ajax({
            type: "POST",
            contentType: "application/json",
            url: "/Home/GenerateDB",
            dataType: "json",
            async: true
        })
			.done(function (msg) {
			    if (msg == true) {
			        alert("A generálás sikerült");
			    }
			    else {
			        alert("A generálás során hiba történt");
			    }
			    hideLoader();
			});
    }
</script>

<h2>
    Admin menü</h2>
@if (ViewBag.Created == true)
{
    <div class="ui-widget">
        <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
            <p>
                <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                <strong>OK!</strong> A létrehozás sikeres.</p>
        </div>
    </div>
    <br />
    <br />
}
else if (ViewBag.Created == false)
{
    <div class="ui-widget">
        <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
            <p>
                <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
                <strong>HIBA!</strong> A létrehozás nem sikerült.</p>
        </div>
    </div>
    <br />
    <br />
}
<div>
    <fieldset>
        <legend>Mintaadatbázis generálása</legend>
        <br />
        <a href="#" class="buttonclass" style="color: white;" onclick="generate();">GENERÁLÁS</a><br /><br />

        <strong>Hallgatók:</strong> user: STUXXX / pass: hallg / <em>(XXX = 000..149)</em><br />
        <strong>Oktatók:</strong> user: TEAXXX / pass: okt / <em>(XXX = 000..149)</em><br />

    </fieldset>
</div>

@using (Html.BeginForm())
{
    <div>
        <fieldset>
            <legend>Új felhasználó</legend>
            <div class="editor-label">
                Neptun kód:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Neptun)
            </div>
            <div class="editor-label">
                Név:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Name)
            </div>
            <div class="editor-label">
                Jelszó hash (SHA1):
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.User.Password)
            </div>
            <div class="editor-label">
                E-mail cím:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Email)
            </div>
            <div class="editor-label">
                Rang:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Rank)
            </div>
            <p>
                <input type="submit" value="Létrehozás" />
            </p>
        </fieldset>
    </div>
}
@using (Html.BeginForm())
{
    <div>
        <fieldset>
            <legend>Új tárgy</legend>
            <div class="editor-label">
                Neptun kód:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Subject.neptun)
            </div>
            <div class="editor-label">
                Név:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Subject.name)
            </div>
            <p>
                <input type="submit" value="Létrehozás" />
            </p>
        </fieldset>
    </div>
}
@using (Html.BeginForm())
{
    <div>
        <fieldset>
            <legend>Új kurzus</legend>
            <div class="editor-label">
                Tárgykód:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Course.subjectid)
            </div>
            <div class="editor-label">
                Szemeszter:
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Course.semester)
            </div>
            <p>
                <input type="submit" value="Létrehozás" />
            </p>
        </fieldset>
    </div>
}



